/*
 * @file    palindrome.cpp
 * @author  edward <libo@tencent.com>
 * @date    2013-04-01
 * @brief   
 * */

#include <iostream>
#include <string.h>

using namespace std;

bool isPalindrome(int p) {
    if(p < 0)
        return false;
    int div = 1;
    while(p / div >= 10) {
        div *= 10; 
    }
    while( p>0 ) {
        int l = p / div % 10;
        int r = p % 10;
        if(l != r) return false;
        p = p % div / 10;
        div /= 100;
    }
    return true; 
}

bool isPalindromeChar(const char* str) {
    int l = 0;
    int r = strlen(str) - 1;
    while(r > l) {
        if(str[r] != str[l]) {
            return false;
        }
        ++l;
        --r;
    }
    return true;
}

int main() {
    //bool ret = isPalindrome(1);
    char tmp[30];
    strcpy(tmp, "ee");
    if(isPalindromeChar(tmp)){
        cout << "true";
    } else {
        cout << "false";
    }
}
